package puntaelena.graphsupport.solver;

import laboratoryQ.common.IDisposable;
import puntaelena.graphsupport.FacilitiesGraph;
import puntaelena.graphsupport.NativeGraphSupportBridge;
import puntaelena.graphsupport.solver.IFacilityLocationSolver;

public class NativeFacilityLocationSolver
	implements IFacilityLocationSolver, IDisposable
{
	private int nativeSolver_ptr;

	public NativeFacilityLocationSolver(int nativeSolver_ptr) {
		this.nativeSolver_ptr = nativeSolver_ptr;
	}

	@Override
	public void solve(FacilitiesGraph fgraph, boolean[] isfcltOpen, int[] witnesses) {
		NativeGraphSupportBridge.nativeSolve(nativeSolver_ptr, fgraph, isfcltOpen, witnesses);
	}

	@Override
	public void dispose() {
		NativeGraphSupportBridge.nativeDisposeSolver(nativeSolver_ptr);
		nativeSolver_ptr = 0;
	}
}
